<?php
/**
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; version 3 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
*/

/**
 * Superglobals abstract class.
 * @package Core
 * @subpackage HTTP.Superglobals
 * @author pilou
 */
namespace Core\HTTP\Superglobal;

abstract class ASuperglobal implements ISuperglobal
{
	/**
	 * Instance static variable for the superglobals
	 * @var array
	 */
	protected static $_instance = array();
	
	/**
	 * Constrtuctor, use getInstance() factory method instead
	 * @access private
	 * @return void
	 */
	public function __construct(){
	}
	
	/**
	 * Facotry method for Superglobals
	 * @access public
	 * @access static
	 * @return ASuperglobal
	 */
	public static function getInstance(){
		$className = get_called_class();
		if (!isset(static::$_instance[$className])){
			static::$_instance[$className] = new $className();
		}
		return static::$_instance[$className];
	}

}
?>